package com.example.shiwuyouproject.ui.fragment.my.activity.viewmodel

import androidx.lifecycle.MutableLiveData
import com.example.shiwuyouproject.base.BaseViewModel
import com.example.shiwuyouproject.ui.fragment.my.activity.bean.DataListsBean
import com.example.shiwuyouproject.ui.my.bean.PersonalInformationBean

class SubjectViewModel:BaseViewModel() {
    private val getRealNameAuthenticatioApi by lazy { RetrofitClient.getApiService() }

    val getGenRenStatus = MutableLiveData<PersonalInformationBean>()
    fun getRealNameAuthenticationData(){
        launch(
                block = {
                    val codeStatus = getRealNameAuthenticatioApi.userUpdate()
                    getGenRenStatus.value=codeStatus.result()
                },
                error = {
                },
                cancel = {

                },
                showErrorToast = false
        )
    }


    val getdataListsStatus = MutableLiveData<DataListsBean>()
    fun getdataLists(){
        launch(
            block = {
                val codeStatus = getRealNameAuthenticatioApi.dataLists()
                getdataListsStatus.value=codeStatus.result()
            },
            error = {
            },
            cancel = {

            },
            showErrorToast = false
        )
    }
    val getPostStatus = MutableLiveData<Boolean>()
    /**
     * 学科科目
     *
     */
    fun jiaoxuetedian(grade:String, subject
    :String){
        val hashMap:MutableMap<String, String> = HashMap()
        hashMap["grade"] = grade
        hashMap["subject"] = subject
        launch(
            block = {
                val codeStatus = getRealNameAuthenticatioApi.addUserUpdate(hashMap)
                getPostStatus.value=codeStatus.success()
            },
            error = {
                getPostStatus.value=false
            },
            cancel = {
                getPostStatus.value=false
            },
            showErrorToast = false
        )
    }

}